@echo off
echo DigiJoe builder	by Joez

reg query "HKLM\Software\JavaSoft\Java Runtime Environment" | find /C /I "java" > tmpFile
set /p myString=<tmpFile
del tmpFile
if %myString% == 0 ( 
	echo Java Environment not found, please follow the instructions given in the documentation. 
) else (
	if exist "D:\Program Files\Java\jdk1.6.0_14\bin\javac.exe" (
		mkdir bin
		"D:\Program Files\Java\jdk1.6.0_14\bin\javac.exe" -d bin -Xlint -classpath bin src\prototype\*.java
		
		echo java skeleton.Main>>bin\start.bat
		"D:\Program Files\Java\jdk1.6.0_14\bin\javadoc.exe" ./src/prototype/*.java -d ./javadoc/ -charset utf-8
		javadoc\index.html
		echo Done
		echo Starting program...
		cd bin
		cls
		java prototype.Main
		@echo on
	)else (
		if exist "C:\Program Files\Java\" (
			mkdir bin
			javac -d bin -Xlint -classpath bin src\prototype\*.java
			
			echo java skeleton.Main>>bin\start.bat
			javadoc ./src/prototype/*.java -d ./javadoc/ -charset utf-8
			javadoc\index.html
			echo Done
			echo Starting program...			
			cd bin
			cls
			java prototype.Main
		) else (
			if exist "D:\Program Files\Java\" (
				mkdir bin
				javac -d bin -Xlint -classpath bin src\prototype\*.java
				
				echo java skeleton.Main>>bin\start.bat
				javadoc ./src/prototype/*.java -d ./javadoc/ -charset utf-8
				javadoc\index.html
				echo Done
				echo Starting program...			
				cd bin
				cls
				java prototype.Main
			) else (
				echo There was a problem with the building process, please follow the instructions given in the documentation. 
			)
		)
	)
)